# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-stix-validator
pkgname=('python2-stix-validator' 'python-stix-validator')
_pkgname=stix-validator
pkgver=3.0.0
pkgrel=2
pkgdesc='APIs and scripts for validating STIX and CybOX documents.'
arch=('any')
url='https://pypi.org/project/stix-validator/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('2fbd3c9b487a72ec800b5eeecab377218f179b4cc7744b11e6b2f8ed309486b7157b620bf1fb382206d814434f07cb57f851d57bb6eb52d685e0f6061fdd7839')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-stix-validator() {
  depends=('python2' 'python2-lxml' 'python2-xlrd' 'python2-ordereddict')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build

  for i in "$pkgdir/usr/bin/"*; do
    mv $i "${i}2"
  done
}

package_python-stix-validator() {
  depends=('python' 'python-lxml' 'python-xlrd' 'python-ordereddict')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build
}

